import sys

lli_cmd = 'lli'
if config.riscv_emulator_lli_executable:
    lli_cmd = config.riscv_emulator_lli_executable

config.substitutions.append(('%mlir_native_utils_lib_dir',
    config.riscv_emulator_utils_lib_dir or config.mlir_lib_dir))

if config.riscv_vector_emulator_executable:
    # Run test in qemu emulator.
    emulation_cmd = config.riscv_vector_emulator_executable
    if config.riscv_vector_emulator_options:
        emulation_cmd = emulation_cmd + ' ' + config.riscv_vector_emulator_options
    emulation_cmd = emulation_cmd + ' ' + lli_cmd + ' --march=riscv64 -mattr=+v '
    config.substitutions.append(('%lli', emulation_cmd))
else:
    config.substitutions.append(('%lli', lli_cmd))
